package com.edu.exam.enums.academic;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 学年状态枚举
 */
@Getter
@AllArgsConstructor
public enum AcademicYearStatus {
    PLANNING("PLANNING", "规划中"),
    ACTIVE("ACTIVE", "进行中"),
    COMPLETED("COMPLETED", "已完成"),
    SUSPENDED("SUSPENDED", "已暂停"),
    CANCELLED("CANCELLED", "已取消");

    private final String code;
    private final String description;

    public static AcademicYearStatus fromCode(String code) {
        for (AcademicYearStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown status code: " + code);
    }
}